package bch.redis_search;

import jakarta.annotation.Resource;
import org.redisson.api.RedissonClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Resource
    private RedissonClient redissonClient;
    @GetMapping("/get")
    public String test(@RequestParam("key") String key) {
        return (String) redissonClient.getBucket(key).get();
    }

    @GetMapping("/set")
    public String set(@RequestParam("key") String key, @RequestParam("value") String value) {
        redissonClient.getBucket(key).set(value);
        return "success";
    }
}
